/**
 * 
 */
package com.atozsoft.wf;

import java.util.ArrayList;
import java.util.List;
import com.eos.system.annotation.Bizlet;
import commonj.sdo.DataObject;
import com.eos.workflow.omservice.WFParticipant;

/**
 * @author houfy
 * @date 2015-01-22 11:15:07
 *
 */
@Bizlet("ProcessParticipantClass")
public class ProcessParticipantClass {
	/**
	 * @author mengbq
	 * 
	 */
	@Bizlet("")
	public static List<WFParticipant> getProcessParticopantList(DataObject[] objs) {
	
		List<WFParticipant> list = new ArrayList<WFParticipant>();
		if(objs != null){
			for(DataObject obj : objs){
				WFParticipant wp = new WFParticipant();
				wp.setId(obj.get("empid").toString());
				wp.setName(obj.get("empname").toString());
				wp.setTypeCode("emp");
				list.add(wp);
			}
		}
		return list;
	}
	
	/**
	 * @author mengbq
	 * 
	 */
	@Bizlet("")
	public static List<WFParticipant> getProcessParticopantList2(DataObject[] objs) {
	
		List<WFParticipant> list = new ArrayList<WFParticipant>();
		if(objs != null){
			for(DataObject obj : objs){
				WFParticipant wp = new WFParticipant();
				wp.setId(obj.get("EMPID").toString());
				wp.setName(obj.get("EMPNAME").toString());
				wp.setTypeCode("emp");
				list.add(wp);
			}
		}
		return list;
	}
	
	/**
	 * list add
	 * @author chenhe
	 * @param objs
	 * @return
	 */
	@Bizlet("")
	public static List<WFParticipant> addProcessParticopantList(List<WFParticipant> partList, WFParticipant part) {
		if(partList == null) {
			partList = new ArrayList<WFParticipant>();
		}
		if(part != null){
			WFParticipant tempPart = new WFParticipant();
			tempPart.setId(part.getId());
			tempPart.setName(part.getName());
			tempPart.setTypeCode(part.getTypeCode());
			//tempPart.setEmail(part.getEmail());
			partList.add(tempPart);
		}
		return partList;
	}
}
